package cn.jzx.smph.dao;

import cn.jzx.smph.entity.Emp;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmpDao {
    //UPSERT INTO emp(id, name, age) VALUES (#{id}, #{name}, #{age})
    @Insert("UPSERT INTO emp(id, name, age) VALUES (#{id}, #{name}, #{age})")
    void saveOrUpdate(Emp emp);
    //DELETE FROM emp WHERE ID=#{id}
    @Delete("DELETE FROM emp WHERE ID=#{id}")
    void delete(String id);
    //select * from emp
    @Select("select * from emp")
    List<Emp> list();
}